Skip to content

Bump PHP Unit to ^12 version#29

Merged
MekDrop merged 1 commit intoimponeer:mainfrom
MekDrop:upgrade-phpunit
Jun 3, 2025
Merged

Bump PHP Unit to ^12 version#29
MekDrop merged 1 commit intoimponeer:mainfrom
MekDrop:upgrade-phpunit

Conversation

@MekDrop
Copy link
Copy Markdown
Member

@MekDrop MekDrop commented Jun 3, 2025

Summary by CodeRabbit

  • Chores

    • Updated development dependencies to support newer versions of testing tools.
    • Reformatted configuration files for improved clarity.
  • Tests

    • Migrated test data providers to use attribute-based syntax for better compatibility with recent testing frameworks.
    • Updated test methods to use static data provider methods.

@MekDrop MekDrop requested a review from Copilot June 3, 2025 11:10
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jun 3, 2025

Walkthrough

The changes update the PHPUnit version constraint in the development dependencies and migrate test classes to use PHPUnit's attribute-based data providers instead of docblock annotations. Data provider methods in test classes are now static, and relevant import statements for attributes are added. No changes were made to test logic or public APIs.

Changes

File(s) Change Summary
composer.json Moved require-dev section, updated phpunit/phpunit to ^12, reformatted scripts section.
tests/CriteriaCompoTest.php Migrated to attribute-based data providers, made provider methods static, updated imports.
tests/CriteriaItemTest.php Migrated to attribute-based data providers, made provider methods static, updated imports.

Poem

In the garden of code, a fresh breeze blew,
PHPUnit grew up, now version twelve anew!
Data providers static, with attributes in tow,
Our tests hop forward, in a modernized row.
With carrots for logic, and lettuce for flair,
The code-rabbit cheers, "Progress everywhere!" 🥕


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1d315ec and 58257b0.

📒 Files selected for processing (3)
  • composer.json (1 hunks)
  • tests/CriteriaCompoTest.php (5 hunks)
  • tests/CriteriaItemTest.php (5 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
tests/CriteriaCompoTest.php (1)
tests/CriteriaItemTest.php (3)
  • DataProvider (98-118)
  • DataProvider (142-149)
  • provideOrder (125-133)
🔇 Additional comments (11)
composer.json (1)

32-35: Bump PHPUnit to ^12 and relocate require-dev
The phpunit/phpunit constraint has been upgraded to ^12, and the require-dev section is now placed after scripts. Ensure this aligns with PHP≥8.3 (PHPUnit 12 requires ≥8.1) and that composer.json remains valid.

tests/CriteriaItemTest.php (5)

10-10: Import the DataProvider attribute
Adding use PHPUnit\Framework\Attributes\DataProvider; is required for attribute-based data providers under PHPUnit 12.


25-25: Declare provideComparisonOperators() as static
Converting the data provider to final public static is necessary for PHPUnit 12’s attribute-based providers.


98-98: Apply #[DataProvider] to testIfOperatorRendersContent()
Replacing the docblock @dataProvider with #[DataProvider('provideComparisonOperators')] aligns the test with PHPUnit 12 syntax.


125-125: Declare provideOrder() as static
The final public static signature enables the #[DataProvider] attribute to work correctly.


142-142: Apply #[DataProvider] to testOrder()
Using #[DataProvider('provideOrder')] updates the test to PHPUnit 12’s attribute style.

tests/CriteriaCompoTest.php (5)

12-12: Import the DataProvider attribute
Added use PHPUnit\Framework\Attributes\DataProvider; to support attribute-based data providers in this class.


25-25: Declare provideCondition() as static
Switching to final public static is required for the #[DataProvider] mechanism in PHPUnit 12.


71-71: Apply #[DataProvider] to testCondition()
Replaced the legacy docblock annotation with #[DataProvider('provideCondition')], conforming to PHPUnit 12 standards.


116-116: Declare provideOrder() as static
Converted to a static provider method so it can be referenced by the attribute.


131-131: Apply #[DataProvider] to testOrder()
The #[DataProvider('provideOrder')] attribute cleanly replaces the old @dataProvider docblock.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR upgrades the project’s PHPUnit dependency from ^9.5 to ^12 and updates existing test classes to use the new Attributes-based data providers.

  • Bumps phpunit/phpunit in composer.json to ^12.
  • Imports and applies #[DataProvider] attributes instead of @dataProvider annotations.
  • Marks data provider methods as static to satisfy PHPUnit 12 requirements.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
tests/CriteriaItemTest.php Swapped @dataProvider for #[DataProvider], made providers static, and imported the attribute.
tests/CriteriaCompoTest.php Same updates as above: attributes, static providers, and import addition.
composer.json Moved and bumped the require-dev block to PHPUnit ^12.
Comments suppressed due to low confidence (2)

composer.json:29

  • [nitpick] The require-dev block was moved below scripts. Consider keeping require-dev before scripts to maintain consistency with the previous structure and reduce noise in future diffs.
"scripts": {

tests/CriteriaItemTest.php:25

  • [nitpick] After removing the @dataProvider annotation, there’s an extra blank line in the docblock. Consider cleaning up leftover blank lines to keep docblocks tidy.
final public static function provideComparisonOperators(): array

@MekDrop MekDrop merged commit 554ee66 into imponeer:main Jun 3, 2025
5 checks passed
@MekDrop MekDrop deleted the upgrade-phpunit branch June 3, 2025 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants